# 判断一个对象是可迭代对象
from collections.abc import Iterable


print(isinstance(123, Iterable))
print(isinstance('ABCV', Iterable))

def findMinAndMax(L):
    if len(L) > 0:
        maxNum = None
        minNum = None
        for num in L:
            if maxNum == None:
                maxNum = num
            elif maxNum < num:
                maxNum = num
            if minNum == None:
                minNum = num
            elif minNum > num:
                minNum = num
        return (minNum, maxNum)
    return (None, None)

# 测试
if findMinAndMax([]) != (None, None):
    print('测试失败!')
elif findMinAndMax([7]) != (7, 7):
    print('测试失败!')
elif findMinAndMax([7, 1]) != (1, 7):
    print('测试失败!')
elif findMinAndMax([7, 1, 3, 9, 5]) != (1, 9):
    print('测试失败!')
else:
    print('测试成功!')
